package cn.taqu.dsl

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import cn.taqu.dsl.activity.FirstActivity
import cn.taqu.dsl.activity.SecondActivity

class MainActivity : AppCompatActivity(), View.OnClickListener {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        findViewById<View>(R.id.btnXml).setOnClickListener(this)
        findViewById<View>(R.id.btnDSL).setOnClickListener(this)
    }

    override fun onClick(view: View?) {
        if (view == null) {
            return
        }
        when (view.id) {
            // xml绘制
            R.id.btnXml -> {
                startActivity(Intent(this, FirstActivity::class.java))
            }
            // dsl 绘制
            R.id.btnDSL -> {
                startActivity(Intent(this, SecondActivity::class.java))
            }
        }
    }
}